
<meta charset="UTF-8">
<title>编辑角色 - 角色管理</title>
<meta name="keywords" content="H-ui.admin v3.0,H-ui网站后台模版,后台模版下载,后台管理系统模版,HTML后台模版下载">
<meta name="description" content="H-ui.admin v3.0，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
</head>
<body>
<article class="cl pd-20">
    <form action="{:url('Role/edit')}" method="post" class="form form-horizontal" id="form-admin-add">
        <input type="hidden" name="id" value="{$data.id}">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>角色名称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$data.role_name}" placeholder="" id="adminName" name="role_name">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">网站权限：</label>
            <dl class="formControls col-xs-8 col-sm-9">
                {foreach $auth_data as $k=>$v}
                {switch name="$v['level']"}
                {case value="0"}
                {if condition="($k != 0) && ($v['level'] == 0)"}
                </dd></dl></dd></dl>
            {/if}
            <dl class="permission-list">
                <dt>
                    <label>
                        <input type="checkbox" value="{$v.id}" name="a_ids[]" id="user-Character-0" {if strpos(','.$data.a_ids.',',','.$v.id.',') !== false}checked{/if}>
                        {$v.auth_name}</label>
                </dt>
                <dd>
                    <dl class="cl permission-list2">
                        {/case}
                        {case value="1"}
                        <dt>
                            <label class="">
                                <input type="checkbox" value="{$v.id}" name="a_ids[]" id="user-Character-0-0" {if strpos(','.$data.a_ids.',',','.$v.id.',') !== false}checked{/if}>
                                {$v.auth_name}</label>
                        </dt>
                        <dd>
                            {/case}
                            {case value="2"}

                            <label class="">
                                <input type="checkbox" value="{$v.id}" name="a_ids[]" id="user-Character-0-0-0" {if strpos(','.$data.a_ids.',',','.$v.id.',') !== false}checked{/if}>
                                {$v.auth_name}</label>
                            {/case}
                            {/switch}
                            {/foreach}
                        </dd>
                    </dl>
                </dd>
            </dl>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>排序：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$data.orders}" placeholder="" id="phone" name="orders">
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>
<script>

    $(function(){
        $(".permission-list dt input:checkbox").click(function(){
            $(this).closest("dl").find("dd input:checkbox").prop("checked",$(this).prop("checked"));
        });
        $(".permission-list2 dd input:checkbox").click(function(){
            var l =$(this).parent().parent().find("input:checked").length;
            var l2=$(this).parents(".permission-list").find(".permission-list2 dd").find("input:checked").length;
            if($(this).prop("checked")){
                $(this).closest("dl").find("dt input:checkbox").prop("checked",true);
                $(this).parents(".permission-list").find("dt").first().find("input:checkbox").prop("checked",true);
            }
            else{
                if(l==0){
                    $(this).closest("dl").find("dt input:checkbox").prop("checked",false);
                }
                if(l2==0){
                    $(this).parents(".permission-list").find("dt").first().find("input:checkbox").prop("checked",false);
                }
            }
        });
    });
</script>

<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>